﻿using OneDark.Update;
using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;

namespace OneDark.Converters
{
    internal class GitPullStatusCvt : IValueConverter
    {
        object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            GitProperty gitProperty = value as GitProperty;
            if (gitProperty == null)
            {
                return null;
            }
            SolidColorBrush brush;
            switch (gitProperty.PullStatus)
            {
                case RepoPullStatus.Conflict:
                    brush = Brushes.Pink;
                    break;

                case RepoPullStatus.PullFinished:
                    brush = Brushes.GreenYellow;
                    break;

                case RepoPullStatus.PullStart:
                    brush = Brushes.LightCyan;
                    break;

                default:
                    brush = Brushes.Transparent;
                    break;
            }
            return brush;
        }

        object IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}